#-------------------------------------------------------------
# Environment Variables
#-------------------------------------------------------------
export PS1="\[\e[1;30m\]\h$ \[\e[0m\]"

export PATH=/usr/local/mysql/bin:$PATH

export DJANGO_SETTINGS_MODULE=yuan_settings
export PATH=/Library/Python/2.6/site-packages/django/bin:$PATH
export PYTHONPATH=.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH    # added by MacPorts

#-------------------------------------------------------------
# Startup
#-------------------------------------------------------------
echo && fortune && echo

#-------------------------------------------------------------
# Navigation
#-------------------------------------------------------------

alias ..='cd ..'
alias ...='cd ../..'
alias desktop='cd ~/Desktop/; pwd'
alias ~='cd ~; pwd'

#-------------------------------------------------------------
# The 'ls' Family
#-------------------------------------------------------------
alias ll='ls -l'                            # list long form
alias ls='ls -hF'                           # add colors for filetype recognition
alias la='ls -a'                            # show hidden files
alias lk='ls -lSr'                          # sort by size, biggest last
alias lc='ls -ltcr'                         # sort by and show change time, most recent last
alias lu='ls -ltur'                         # sort by and show access time, most recent last
alias lt='ls -ltr'                          # sort by date, most recent last
alias lm='ls -al | more'                    # pipe through 'more'
alias lr='ls -lR'                           # recursive ls

#-------------------------------------------------------------
# Others
#-------------------------------------------------------------

alias bashrc='mate ~/.bashrc'
alias bash_profile='mate ~/.bash_profile'

#-------------------------------------------------------------
# Apple iTunes Control
#-------------------------------------------------------------
alias play='osascript -e "tell application \"iTunes\" to play"'
alias pause='osascript -e "tell application \"iTunes\" to pause"'
alias next='osascript -e "tell application \"iTunes\" to next track"'
alias prev='osascript -e "tell application \"iTunes\" to previous track"'

#-------------------------------------------------------------
# Web Development
#-------------------------------------------------------------
alias sandbox='cd ~/Sites/sandbox/; pwd'
alias pmpy='python manage.py'

#-------------------------------------------------------------
# Beaconpass Specific
#-------------------------------------------------------------
alias bp='cd ~/src/unveiledarts/; pwd'
alias bp_syncdb='cd ~/src/sql/; scp beaconpass@beaconpass.com:~/sql/beaconpass_beta.sql .; mysql -uroot beaconpass_beta < beaconpass_beta.sql'
alias bp_syncphotos='cd ~/src/unveiledarts/static/; rsync -vur beaconpass@beaconpass.com:~/webapps/beta_static/photo_uploads .'

#-------------------------------------------------------------
# Functions
#-------------------------------------------------------------

trash() { mv $@ ~/.Trash/ ; }

function google() {
    query=''
    for arg in $@; do
        query="$query%20$arg"
    done;
    open "http://www.google.com/search?q=$query"
}

safari () {
    url=$1
    if [ ! -e "$url" ] && [[ ! "$url" =~ http://.* ]]
    then
        url="http://$url"
    fi
    open -a "Safari" $url ;
}

chrome () {
    url=$1
    if [ ! -e "$url" ] && [[ ! "$url" =~ http://.* ]]
    then
        url="http://$url"
    fi
    open -a "Google Chrome" $url ;
}

